package com.csyf.manager.controller.agent;

import com.csyf.manager.entity.BalanceShowVo;
import com.csyf.manager.entity.SysAgent;
import com.csyf.manager.entity.SysMerchant;
import com.csyf.manager.entity.SysUser;
import com.csyf.manager.service.ProxyQueryBiz;
import com.csyf.manager.service.SysAgentService;
import com.csyf.manager.service.SysMerchBiz;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @Author: casper
 * @Description: 代理商信息Controller
 * @Date: Created in 2018/11/30 15:52
 */
@Controller
@RequestMapping("/agent")
public class AgentInfoController {

    @Autowired
    private SysAgentService sysAgentService;

    /**
     * 商户信息展示
     * @param model
     * @return
     */
    @GetMapping(value = "agentInfo")
    public String agentInfo(Model model) {

        SysAgent agentInfo = getAgentInfo();
        model.addAttribute("agent",agentInfo);
        return "sysAgent/agentInfo";
    }


    public SysAgent getAgentInfo() {
        SysUser sysUser = (SysUser) SecurityUtils.getSubject().getPrincipal();
        SysAgent agent = sysAgentService.queryAgentByUserId(sysUser.getUserId());
        return agent;
    }



}
